package cn.udinghuo.model.archives.yxy;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.core.domain.entity.BaseEntity;	
import cn.udinghuo.model.archives.yxy.TenantSource;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;

/**
 * @author ssk
 *	营销云用户关系
 */
@Entity
@Table(name="yxyuser")
public class TenantUser extends BaseEntity<Long>  {

	private static final long serialVersionUID = 1862270976L;
	/**
	* 租户IDtenantId
	*/
	@Comment(value="租户ID")
	@Column(name="cTenantId")
	private String tenantId;
	/**
	* 用户IDtenantUserId
	*/
	@Comment(value="用户ID")
	@Column(name="cTenantUserId")
	private String tenantUserId;
	/**
	* 订货用户IDuserId
	*/
	@Comment(value="订货用户ID")
	@Column(name="iUserId")
	private Long userId;
	/**
	* 用户来源source
	*/
	@Comment(value="用户来源")
	@Column(name="iSource")
	private Short source;
	/**
	* 组织orgId
	*/
	@Comment(value="组织")
	@Column(name="iOrgId")
	private Long orgId;
	public String getTenantId() {
		return this.tenantId;
	}
	
	public void setTenantId(String value) {
		this.tenantId = value;
	}
	
	public String getTenantUserId() {
		return this.tenantUserId;
	}
	
	public void setTenantUserId(String value) {
		this.tenantUserId = value;
	}
	
	public Long getUserId() {
		return this.userId;
	}
	
	public void setUserId(Long value) {
		this.userId = value;
	}
	
	public TenantSource getSource() {
        if(this.source == null){
			return null;
		}
		return TenantSource.find(this.source.intValue());
	}
	@JsonSetter
	public void setSource(TenantSource value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.source = value.getValue();
	}
	
	public void setSource(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(TenantSource.find(value.intValue()),"enum value is invalid value!"); 
		this.source = value;
	}
	
	public Long getOrgId() {
		return this.orgId;
	}
	
	public void setOrgId(Long value) {
		this.orgId = value;
	}
	
}
